package com.my.cd.command;

/**
 * 具体命令实现：音响音量减小
 */
public class StereoSubVolCommand implements Command {

    private Stereo setreo;

    public StereoSubVolCommand(Stereo setreo) {
        this.setreo = setreo;
    }

    @Override
    public void execute() {
        int vol = setreo.getVol();
        if (vol > 0) {
            setreo.setVol(--vol);
        }
    }

    @Override
    public void undo() {
        int vol = setreo.getVol();
        if (vol < 11) {
            setreo.setVol(++vol);
        }
    }

}
